﻿{include file="common@public/_category" /}


  <!--container-->
  <div class="container container-gary">
      <!-- member index -->
      <div class="m-ptb wrap clearfix">
          {include file="common@public/_personal_left"}
          <div class="member-right">
              <div class="member-sign clearfix">
                  <b>子账号管理</b>
                  <div class="address-span">
                      <input class="address-s-color" type="button" value="新建子账号" onclick="location.href='{:url(\'member/addsubbill\')}'">
                  </div>
              </div>
              <div class="member-order min-height">
                <form action="">
                  <div class="m-order-enter add-new-style clearfix">
                      <div class="m-order-left">
                          <div class="m-order-item">
                              <div class="m-order-text subbill-w1">子账号：</div>
                              <div class="m-order-write">
                                  <input class="m-input-small subbill-w" value="{:input('subbillname')}" type="text" name="subbillname" placeholder="请输入子账号">
                              </div>
                          </div>
                          <div class="m-order-item">
                              <div class="m-order-text subbill-w1">子账号姓名：</div>
                              <div class="m-order-write">
                                  <input class="m-input-small subbill-w2" type="text" value="{:input('name')}" name='name' placeholder="请输入子账户名称">
                              </div>
                          </div>
                      </div>
                      <div class="m-order-right">
                          <input class="m-btn-color" type="submit" value="搜索">
                      </div>
                  </div>
                  </form>

                  <div class="whitebar-content">
                      <div class="member-thead clearfix">
                          <div class="whitebar-t-w1">
                              <div class="checked-total"><input class="ck_all" tabindex="1" type="checkbox"><label for="">全选</label></div>
                          </div>
                          <div class="subbill-t-w2">子账号</div>
                          <div class="subbill-t-w3">子账号姓名</div>
                          <div class="subbill-t-w4">QQ</div>
                          <div class="subbill-t-w6">角色</div>
                          <!-- <div class="subbill-t-w7">操作人</div> -->
                          <div class="subbill-t-w8">操作时间</div>
                          <div class="subbill-t-w2">操作管理</div>
                      </div>
                      {foreach name='data_list' item='vo'}
                      <div class="address-item">
                          <div class="add-i-total whitebar-t-w1">
                              <div class="checked-total"><input tabindex="1" value="{$vo.id}" type="checkbox" class="ck_item" name="items"></div>
                          </div>
                          <div class="add-i-total subbill-t-w2">{$vo.subbillname}</div>
                          <div class="add-i-total subbill-t-w3">{$vo.name}</div>
                          <div class="add-i-total subbill-t-w4">{$vo.qq}</div>
                          <div class="add-i-total subbill-t-w5">{$vo.rolename}</div>
                          <!-- <div class="add-i-total subbill-t-w7">14203</div> -->
                          <div class="add-i-total subbill-t-w8">{$vo.update_time|date='Y-m-d H:i:s',###}</div>
                          <div class="add-i-total subbill-t-w2"><a class="subbill-a" href="{:url('member/editsubbill',['id' => $vo.id])}">修改</a> <em class="subbill-plr">|</em> <span class="subbill-span del_onesubbill" data-url="{:url('member/del_subbill',['id' => $vo.id])}" style="cursor:pointer;">删除</span></div>
                      </div>
                      {/foreach}
                      
                  </div>

                  <div class="inpuire-b-select clearfix">
                      <div class="inpuire-left">
                          <div class="checked-total"><input class="ck_all" tabindex="1" type="checkbox"><label for="">全选</label></div>
                      </div>
                      <div class="inpuire-b-del"><span class="red del_allsubbill">选中删除</span></div>
                      <div class="pager address-pager">
                          {$page}
                          {if condition="$all_page gt 1"}                          
                          <em>到第</em><input class="page-input" type="number" max='{$all_page}' min='1' /><i>页</i><input class="page-btn" type="button" value="确认" />
                          {/if}
                      </div>
                  </div>
              </div>
              
          </div>
      </div>

  </div>

  <!-- footer -->
  <!--#include file="includes/foot.html"-->

  <!-- cart del -->
  <div class="total-mask hide"></div>
  <div class="total-content hide">
        <div class="cart-d-content">
            <div class="cart-d-white">
                <div class="cart-d-top clearfix">
                    <div class="cart-d-img"><img src="/public/static/home/images/cart-del.png" /></div>
                    <div class="cart-d-txt">
                        <h3>删除子账号？</h3>
                        确认要删除子账号吗？
                    </div>
                    <div class="cart-d-icon"><i></i></div>
                </div>
                <div class="cart-d-a">
                    <a class="cart-d-color confirm_del" data-url=''>确认</a><a class="cart-d-gary">取消</a>
                </div>
            </div>
        </div>
  </div>

<!-- check -->
<script src="/public/static/home/js/icheck.js"></script>
<!-- menu -->
<script type="text/javascript" src="/public/static/home/js/menu.js"></script>
<script>
    $(function(){
      //top select
      $(".top-select").mouseover(function () {
        $(".top-s-text").show();
      })
      $(".top-select").mouseout(function () {
        $(".top-s-text").hide();
      })
      $(".top-s-text div").click(function () {
        var selecttext = $(this).text();
        $(".top-s-head span").text(selecttext);
        $(this).parent(".top-s-text").hide()
      })
      // top code
      var turn = function(target,time,opts){
      target.find('.top-code').hover(function () {
            $(this).find('.top-c-img').stop().animate(opts[0], time, function () {
			$(this).hide().next().show();
			$(this).next().animate(opts[1],time);
	   });
	   },function(){
	        $(this).find('.top-c-text').animate(opts[0], time, function () {
			    $(this).hide().prev().show();
			    $(this).prev().animate(opts[1],time);
		 });
	     });
        }
        var verticalOpts = [{'width':0},{'width':'80px'}];
        turn($('.top-right'), 150, verticalOpts);
        //menu all
        $(".menu-all div").mouseenter(function () {
            $(this).addClass("current");
            $(".submenu").show();
        })
       $(".menu-all div").mouseleave(function () {
            $(this).removeClass("current");
            $(".submenu").hide();
        })
        $(".submenu").mouseenter(function(){
           $(this).show();
           $(".menu-all div").addClass("current")
        })
        $(".submenu").mouseleave(function(){
           $(this).hide();
           $(".menu-all div").removeClass("current")
        })
        //left submenu
        $(".submenu ul li").each(function () {
            var $this = $(this);
            var $children = $this.find('.submenu-pro');
            var $otherChildren = $this.siblings('li').find('.submenu-pro');
            var $childrenList = $children.children('.submenu-total');
            $this.on({
                'mouseenter': function () {
                    $children.css({ 'display': 'block', 'width': 221 * parseInt($childrenList.size()) });
                    $otherChildren.css('display', 'none');
                },
                'mouseleave': function () {
                    $children.css('display', 'none');
                }
            })
        });
        //input
        $('.checked-total input').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%'
        });
        $('.ck_item').on('ifChanged', function (event) {
            showCheckbox();
        });
        $('.ck_all').on('ifChecked', function (event) {
            $('.checked-total input').iCheck('check');
        });
        $('.ck_all').on('ifUnchecked', function (event) {
            $('.checked-total input').iCheck('uncheck');
        });

        //member left
        $(".member-l-title").click(function(){
           $(this).parent(".member-l-list").toggleClass("m-current");
           $(this).parent(".member-l-list").find("ul").slideToggle()
        })
        //content height
        $(".member-left").height($(".member-right").height())
        //step info
         $(".step-info").hover(function () {
             $(".step-i-text").show()
         }, function () {
             $(".step-i-text").hide()
         })

        //cart del
        $(".subbill-span").click(function(){
            $(".total-mask,.total-content").show()
        })
        $(".cart-d-icon i,.cart-d-gary").click(function(){
            $(".total-mask,.total-content").hide()
        })

    })

    function showCheckbox() {
        if ($('.ck_item').size() == $('.ck_item:checked').size()) {
            $('.ck_all').prop("checked", true).iCheck('update');
        } else {
            $('.ck_all').prop("checked", false).iCheck('update');
        }
    }

</script>

<script>
$('.del_allsubbill').click(function(){
  var items = [];
  $.each($('input[name=items]'),function(key,value){
    if($(value).attr('checked') == 'checked'){
      items.push($(value).val());
    }
  })
  if(parseInt(items.length) == 0){
    alert('请选择需要删除的子账号');
    return false;
  }
  var del_url = "{:url('member/del_allsubbill')}?items="+items;
  $(".total-mask,.total-content").show()
  $('.confirm_del').attr('data-url', del_url)
})
$(".cart-d-icon i,.cart-d-gary").click(function(){
      $(".total-mask,.total-content").hide()
  })

  $('.del_onesubbill').click(function(){
    $(".total-mask,.total-content").show()
    var del_url = $(this).attr('data-url');
    $('.confirm_del').attr('data-url',del_url);
    return false;
  })

  $('.confirm_del').click(function(){
    var del_url = $(this).data('url');
    location.href = del_url;
  })

$('.page-btn').click(function(){
  var num = $('.page-input').val();
  if(parseInt(num) < 1){
    alert('请填写跳转页数');
    return false;
  }
  var url = window.location.href;
  if(url.indexOf('page') == '-1'){
    if(url.indexOf('?') == '-1'){
      var url = url+"?page="+num;
    }else{
      var url = url+"&page="+num;
    }
  }else{
    var reg = /page=.*$/;
    var url = url.replace(reg,'page='+num);
  }
  location.href=url;

})
</script>
</body>
</html>